import Vue from 'vue'
import Vuex from 'vuex'
import { getToken } from '@/api/index.js'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: ''
  },
  mutations: {
    SET_TOKEN(state, token) {
      console.log('#####', token)
      state.token = token
    }
  },
  actions: {
    async getToken({ commit }, preload) {
      const res = await getToken(preload)
      console.log('登录返回信息', res)
      // commit('SET_TOKEN', res.data.token)
    }
  },
  modules: {}
})
